Number place puzzles having triads and use as intermediates to make number place puzzles having nonets

ABSTRACT

Methods and computer software are provided for making number place puzzles having nonets or number place puzzles having triads. For number place puzzles having triads, no object appears more than once in each row and in each column, and each triad contains no more than one object from each of three distinct groups of objects. The software comprises instructions within each of multiple nested loops that limit access to embedded loops until all selected objects form a valid solution. Multiple solutions provide information for modifying the pre-assigned objects to obtain a single solution.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. patent application Ser. No. 12/615,199, filed on Nov. 9, 2009, and includes a computer program listing, submitted electronically as a text file named NPFAST.txt, which text file is incorporated by reference herein.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This application relates to number place puzzles and methods and computer software for creating number place puzzles.

2. Description of the Related Art

Prior application Ser. No. 12/615,199, entitled “METHOD AND SOFTWARE FOR MAKING NUMBER PLACE PUZZLES”, specifically describes making a conventional number place puzzle having nine lines, nine columns, and nine 3×3 regions known as “nonets”. The method and software use multiple loops and early bypass of loops to show all possible solutions to a partial puzzle in a reasonable amount of time. However, for partial puzzles having less than twenty pre-assigned numbers, the processing time can exceed eight hours. Optimization of the software and the puzzle is capable of reducing the processing time for each partial puzzle. For example, the software can be optimized to initially assign missing numbers in complete rows or columns and the partial puzzle can be modified by moving complete rows or columns of nonets to place the largest number of pre-assigned numbers in the rows or columns that are processed early in the multiple loops. Although the processing time is reduced, the time required for showing all solutions may still exceed several hours.

Improvement beyond optimization is needed to make number place puzzles having less than 20 starting numbers in a more reasonable period of time.

SUMMARY OF THE INVENTION

A new type of number place puzzle is provided. In a first embodiment, the number place puzzle comprises nine columns and nine rows defining eighty-one boxes, wherein each row or each column is divided into three triads, and sufficient pre-assigned objects, such as numerals, to form a single solution provided that no object appears more than once in each row and each column, and that each triad contains no more than one object from each of three distinct groups of objects.

Methods and computer software are also provided for making number place puzzles. In a second embodiment, a computer readable medium comprises one or more instructions for sequencing of lines of a partial or complete number place puzzle having triads, one or more instructions for printing a finding of one complete solution or more than one complete solution for the number place puzzle having triads, and a plurality of instructions at a plurality of locations for limiting access to the one or more instructions for printing prior to finding a valid solution to the number place puzzle having triads.

In a third embodiment, the computer readable medium comprises the instructions of the second embodiment and further comprises instructions to convert a number place puzzle having nonets to the number place puzzle having triads and instructions to print all solutions for the number place puzzle having nonets.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the manner in which the above-recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.

FIG. 1 shows a number place puzzle having triads and also having partial pre-assigned numerals used to illustrate the method and software of an embodiment of the present invention.

FIG. 2 shows a flow diagram of a computer program embodiment having nested loops for use in a method embodiment of the present invention.

FIG. 3 shows lines of a computer program that correspond to portions of the flow diagram in FIG. 2.

FIG. 4 shows additional lines of the computer program of FIG. 3.

FIG. 5 shows the results of running one embodiment (NPFAST.txt) of the computer program of FIGS. 3 and 4 on the pre-assigned numerals in FIG. 1.

FIG. 6A shows the processing time for listing all solutions of a partial number place puzzle having nonets and only 16 pre-assigned numerals using the computer program of FIGS. 3 and 4.

FIG. 6B shows the processing time for listing all solutions of the same number place puzzle as FIG. 6A after removing instructions for sequencing lines.

To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures. It is contemplated that elements disclosed in one embodiment may be beneficially utilized on other embodiments without specific recitation.

DETAILED DESCRIPTION

FIG. 1 shows an embodiment of a number place puzzle having a 9×9 array of boxes and multiple groups of three boxes which are named “triads” herein. The array has 9 rows of 9 boxes labeled A through F and 9 columns of 9 boxes labeled 1 through 9. Each row of the number place puzzle is divided into three triads, each triad containing three adjacent boxes. Alternatively, each column could be divided into three triads. In order to have a single solution, the number place puzzle must have sufficient pre-assigned objects to form a single solution provided that no object appears more than once in each row and each column, and that each triad contains no more than one object from each of three distinct groups of objects. A preferred example of three distinct groups is numerals 1-3, numerals 4-6, and numerals 7-9. However, different groupings of numerals will also work, as well as groupings further comprising letters, other symbols, or combinations thereof.

Unlike number place puzzles having nonets, the objects in the number place puzzles have triads are not interchangeable. For example, each “9” in a number place puzzle having nonets can be swapped with each “1”, or replaced with “1” if the number place puzzle does not initially contain a “1”. A similar swap of numerals in a number place puzzle having triads may result in a different puzzle that may have multiple solutions or no solution unless “1” and “9” are also swapped within the three distinct groups of numerals. One reason for this difference is that every number place puzzle having nonets can be converted to a number place puzzle having triads in a manner whereby each object in the number place puzzle having triads no longer represents a single object in the number place puzzle having nonets. In effect, each object in the number place puzzle having nonets is represented by a row or column in the number place puzzle having triads and the numerals or symbols in the number place puzzle having triads represent rows or columns in the number place puzzles having nonets.

For example, the partial pre-assigned numerals in FIG. 1 are directly converted from the partial pre-assigned numerals in FIG. 1 of related U.S. patent application Ser. No. 12/615,199 (FIG. 1 and related text are incorporated by reference herein) by defining box A1 of present FIG. 1 to be the column number containing numeral “1” in Row A of the prior FIG. 1. Likewise, box A9 of present FIG. 1 contains the column number containing numeral “1” in Row I of the prior FIG. 1 and box D1 of present FIG. 1 contains the column number containing numeral “4” in Row A of the prior FIG. 1. Although present FIG. 1 was converted from prior FIG. 1 by correlating numerals 1-9 in the prior figure to Rows A-I in the present figure, respectively, and by correlating the column numbers in the prior figure to the numerals in the present figure, respectively, as described below, any manner of converting the row, columns, and objects could be used.

An advantage of converting number place puzzles having nonets to number place puzzles having triads is that each row or column having triads in the number place puzzle having triads is interchangeable with each other row or column having triads, just like each object in the number place puzzle having nonets is interchangeable with each other object. Thus, each row in present FIG. 1 can be swapped with any other row such that additional pre-assigned objects can be placed in rows that are initially processed.

For example, Row D in current FIG. 1 can be swapped with Row B in current FIG. 1 to provide two additional pre-assigned numerals in the first two rows. Moreover, the final sequence of rows can be changed to A, D, C, F, G, B, E, H, for example, to further enhance early processing of pre-assigned numerals. An embodiment having all of these advantages is further described below.

The pre-assigned numerals in FIG. 1 are further used to illustrate making a number place puzzle. Although the pre-assigned numerals in FIG. 1 were converted from a number place puzzle having nonets as further described below, the pre-assigned numerals can be selected in any manner as long as the rules of this example number place puzzle having triads are obeyed, i.e., each row and column has no duplicate numerals and each triad has only one numeral from 1-3, only one numeral from 4-6, and only one numeral from 7-9. The starting numerals can be pre-assigned before the program is executed as shown in the following Figures. Alternatively, the program can assist in selecting the starting numerals using graphics and dropdown lists.

FIG. 2 shows a flow diagram of a computer program for making number place puzzles according to embodiments of the present invention. The source code for one such program written in BASIC is shown in the computer program identified as NPFAST.txt. The BASIC program was written using JUSTBASIC 1.01 which is freeware available at www.justbasic.com. The attached BASIC program is not free for use in making number place programs if one or more claims below are granted. The computer program can be written in any program language and modified for any similar number place puzzle.

The embodiment shown in FIG. 2 uses sixty-four (64) nested loops to select numerals for most of the eighty-one (81) boxes in the 9×9 number place puzzle of FIG. 1 if not pre-assigned as described in more detail for FIG. 3. The numeral for the last variable in each row and column is the last available numeral if a numeral was not pre-assigned.

Pre-assigned numerals are entered 20 and converted 21 from nonets to sequenced triads or from non-sequenced triads to sequenced triads as described in more detail for FIG. 3. The pre-assigned numerals are then processed by limiting selection of each variable in a first results array to the corresponding pre-assigned numeral as described in more detail for FIG. 4. After a numeral is selected for each variable in the first results array, such as selection of a numeral for A1 22, the numeral is compared 23 to relevant pre-assigned numerals and relevant numerals previously selected by the nested loops. The currently selected numeral is not compared to variables that are to be selected in any loops that are embedded in the loop that selected the numeral because the embedded variables do not yet have a selected numeral for comparison. However, comparison of the selected numeral to embedded variables will occur when a numeral is subsequently selected for each embedded variable.

When the selected numeral for a variable is the same as a compared numeral, embedded loops are bypassed 24 for selection of another numeral for the same variable. If the selected numeral is different from all compared numeral, a numeral is selected for the next variable. After selection of two or more numerals in a triad, the comparison 25 includes confirming that no more than one numeral in the triad is within each group of numerals 1-3, numerals 4-6, and numerals 7-9. The selection of numerals for successive variables continues as long as each previously selected numeral satisfies the comparisons.

When no numeral satisfies the comparisons for a variable, processing returns to selection of another numeral for the prior variable, e.g. selection of A2 exits 26 to selection of another numeral for A1.

When all selected numerals for all variables satisfy the comparisons, the results are converted 27 back to nonets or non-sequenced triads and then printed 28. Thus, the comparison instructions within each loop limit access to successive loops that would print the results unless all comparisons are satisfied. The computer program ends 29 after the possible combinations of selected numerals for the variables have been compared, such that all possible solutions are printed absent limitations on the number of printed solutions.

When the computer program listing (NPFAST.txt) is executed with JUSTBASIC 1.01, up to 200 solutions (when NPMAX=200) are printed to a window and can be saved in a file or printed. Alternatively, after printing a selected number of solutions (which could be 0), further solutions could be indicated by printing only a finding of one complete solution or more than one complete solution. Printing of some solutions is preferred to assist in entry of additional pre-assigned numerals even if there are too many solutions to readily identify a single solution to the number place puzzle.

FIG. 3 shows lines from a preferred computer program listing which illustrate entry of pre-assigned numerals 31, and either conversion 32, 34, 35 of pre-assigned numerals from nonets to sequenced triads, or conversion 33, 34, 36 of pre-assigned numerals from non-sequenced triads to sequenced triads. Although the computer program is similar to the program described for FIGS. 3-4 of related U.S. patent application Ser. No. 12/615,199, which FIGS. 3-4 and accompanying text are incorporated by reference herein, present FIGS. 3-4 emphasize either converting numerals in a partial number place puzzle having nonets to numerals in a number place puzzle having triads or entering numerals in a partial number place puzzle having triads, modifying processing of numerals to solve triads instead of nonets, and converting the numerals in each solution to original form prior to printing.

Data arrays are used in the current computer program to facilitate conversion of variables from nonets to sequenced triads and from non-sequenced triads to sequenced triads. Conversion from nonets to sequenced triads begins by calculating 32 the total number of appearances for each numeral in an initial data array, A(x,y), while initially assigning each numeral to a variable, LN(x), which represents a line in an intermediate data array, P(x,y). Then, the lines and associated total appearances are sequenced 34 by repeatedly swapping two selected lines that are not in the desired sequence wherein LN(1) is a row having the highest number of pre-assigned numerals and LN(9) is a row having the lowest number of pre-assigned numerals. The pre-assigned numerals are then transferred 35 from the initial data array to the appropriate numeral and appropriate position in the intermediate data array.

Although the value of each LN(x) may be repeatedly changed during the sequencing of lines, LN(x) is a one-dimensional array that keeps track of the position of each line in the intermediate data array. For example, if LN(1) equals 4 after sequencing is completed, then the fourth line in the intermediate data array after sequencing corresponds to the first line in the intermediate data array before sequencing occurred. Thus, LN(x) records important information needed to convert each solution back to the form of the initial data array.

When starting with non-sequenced triads in the initial data array, A(x,y), the total number of appearances for each numeral in each line of the initial data array is obtained by summing 33 the total number of appearances in each line and then sequencing 34 the lines and associated total appearance as described for conversion from nonets. The pre-assigned numerals are then transferred 36 from the initial data array to the appropriate line in the intermediate data array.

In the computer program listing, NPFAST.txt, selection of numerals for variables for a first results array, Q(x,y), begins with Row A of the intermediate data array, P(x,y), and progresses through rows B through I because the pre-assigned numerals in the intermediate array have already been moved toward the rows that are processed earliest. Although partial number place puzzles having substantially more than 20 pre-assigned numerals typically do not need the advantage of using triads, changing the sequence of triad rows or columns can reduce processing time from many hours to less than one minute for partial puzzles having less than 20 pre-assigned numerals.

FIG. 4 shows additional lines from the computer program listing to illustrate how numerals are selected for the variables and compared to other selected numerals. Ranges for For/Next loops that construct the first results array, Q(x,y), are limited to selecting pre-assigned numerals 41 or set to “1” and “9” absent a pre-assigned numeral. For each variable, the selected numeral is compared to pre-assigned numerals and previously selected numerals in the same row and same column 42. Subsequent comparisons include more previously selected numerals and fewer pre-assigned numerals than the prior comparisons because the previously selected numerals would be identical to any pre-assigned numeral for the same variable. After selection of numerals for two or three variables in a triad, multiple numerals in any group of numerals are detected 43 as shown for a complete triad having three selected numerals and results in selection of another numeral for the last variable.

After successful selection of numerals for all variables in the triads without duplicates or multiple numerals in any group of numerals, the computer program uses the data from the line variables, LN(x), to convert the first results array, Q(x,y), to a final results array, R(x,y). When the initial data array is based on nonets, each numeral in the first results array is converted 44 to the original nonet format using data from the line variables to reverse the prior sequencing of lines. When the initial data array is based on triads, the rows of numerals in the first results array are converted 45 to the original positions in the initial data array using data from the line variables to reverse the prior sequencing of lines.

If desired, the intermediate array, P(x,y), for a complete number place puzzle having nonets can be printed 45 after conversion of the nonets to triads without sequencing or further processing to form a new number place puzzle having triads. The new puzzle would not be a direct conversion to triads if line sequencing occurred but would have one solution and exchanging of two or more numerals.

After all solutions, if any, are counted or printed, the computer program ends. Alternatively, the program can end after determining whether the is no solution, one solution, or more than one solution. When multiple solutions are obtained, further pre-assignment of numerals may be assisted by comparing the multiple solutions. For example, the pre-assigned numerals shown in FIG. 1 have the four solutions shown in FIG. 5 (which shows the result of executing the computer program listing, NPFAST.txt, filed with this application). Comparing the solutions, only Solution 1 has a numeral 4 at box A5 51 or a numeral 4 at box I8 52, thus pre-assignment of “4” to either box would result in a single solution for the corresponding puzzles as shown for the triad puzzle solutions in FIG. 5.

FIG. 6A shows the starting and ending processing time for making a number place puzzle having nonets and only 16 pre-assigned numerals using the embodiment of a computer program described for FIGS. 3 and 4. The start time 61 and the end time 62 were printed during data processing and show that the total processing time was 23 seconds to list 131 solutions. Only one solution has a 3 at box F5.

FIG. 6B shows the starting and ending processing time for making the same partial number place puzzle as described for FIG. 6A after modifying the same computer program to remove only the instruction for line sequencing 34 which in effect exchanges numerals in the nonets prior to conversion to triads as described for FIG. 3 above. The start time 63 and the end time 64 were printed during data processing and show that the total processing time was over eight hours to list the 131 solutions. Such sequencing of numerals would have no effect on the processing time absent the conversion to triads.

While the foregoing is directed to embodiments of the invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof. 

1. A computer readable medium having instructions for making a number place puzzle, comprising: one or more instructions for sequencing of lines of a partial or complete number place puzzle having triads; one or more instructions for printing a finding of one complete solution or more than one complete solution for the number place puzzle having triads; and a plurality of instructions at a plurality of locations for limiting access to the one or more instructions for printing until all assigned values form a valid solution to the number place puzzle having triads.
 2. The computer readable medium of claim 1, further comprising one or more instructions for converting the partial or complete number place puzzle having nonets to the partial or complete number place puzzle having triads.
 3. The computer readable medium of claim 2, further comprising instructions for printing one or more complete solutions for the number place puzzle having triads or one or more complete solutions for the number place puzzle having nonets.
 4. The computer readable medium of claim 3, further comprising instructions for converting the one or more complete solutions for the number place puzzle having triads to the one or more complete solutions for the number place puzzle having nonets.
 5. The computer readable medium of claim 4, wherein the plurality of instructions at a plurality of locations for limiting access comprise one or more instructions for bypassing embedded loops.
 6. The computer readable medium of claim 5, wherein the one or more instructions for bypassing the embedded loops do not process objects that are selected in embedded loops.
 7. The computer readable medium of claim 6, wherein no object appears more than once in each row and in each column, and each triad contains no more than one object from each of three distinct groups of objects.
 8. The computer readable medium of claim 7, wherein the three distinct groups of objects are numerals 1-3, numerals 4-6, and numerals 7-9.
 9. A method for making a number place puzzle, comprising: determining multiple solutions for pre-assigned objects using the computer readable medium of claim 1; and using the multiple solutions to modify the pre-assigned objects to obtain number place puzzle having a single solution.
 10. A number place puzzle, comprising: nine columns and nine rows defining eighty-one boxes, wherein each row or each column is divided into three triads; and sufficient pre-assigned objects to form a single solution provided that no object appears more than once in each row and each column, and that each triad contains no more than one object from each of three distinct groups of objects.
 11. The number place puzzle of claim 10, wherein the three distinct groups of objects are numerals 1-3, numerals 4-6, and numerals 7-9. 